extends Area2D

var speed = 500
var damage = 10
var push = 20
const FLY = 1
const SPLAT = 2
var status = FLY

var fly_texture = preload('res://res/particle/pea/ProjectilePea.png')
var splats1_texture = preload('res://res/particle/pea/splats1.png')
var splats2_texture = preload('res://res/particle/pea/splats2.png')
var splats3_texture = preload('res://res/particle/pea/splats3.png')
var splats4_texture = preload('res://res/particle/pea/splats4.png')
var splats5_texture = preload('res://res/particle/pea/splats5.png')
var splats6_texture = preload('res://res/particle/pea/splats6.png')
var splats7_texture = preload('res://res/particle/pea/splats7.png')
var splats_texture = [splats1_texture, splats2_texture, splats3_texture, splats4_texture]

func _ready():
	$Sprite2D.texture = fly_texture


func _process(delta):
	if status == FLY:
		position += Vector2(1, 0) * speed * delta


func _on_area_entered(area):
	$Sprite2D.texture = splats_texture[randi() % splats_texture.size()]
	status = SPLAT
	#area_entered.disconnect('_on_area_entered')
